https://leetcode-cn.com/problems/zigzag-conversion/

class Solution {
public:
    string convert(string s, int numRows) {
        if(s.size() <= 1) return s;

        vector<string> v(numRows);  
        
        int i  = 0;
        while(i < s.size())
        {
            for(int row = 0; row < numRows && i < s.size(); row++){
                v[row].push_back(s[i]);
                i++;
            }

            for(int row = numRows - 2; row >= 1 && i < s.size(); row--){
                v[row].push_back(s[i]);
                i++;
            }
        }

        string res;
        for(int i = 0 ; i < numRows; i++){
            res += v[i].c_str(); 
        }
        return res;
    }
};